human(format!("entry is somehow not a subpath \
of the directory being walked."))
})));
- templates.push(Box::new(InputFileTemplateFile::new(entry_path,
+ templates.push(Box::new(InputFileTemplateFile::new(entry_path,
dest_file_name.to_path_buf())));
Ok(())
}));
/// Create a new "lib" project
fn create_lib_template() -> Vec<Box<TemplateFile>> {
let lib_file = Box::new(InMemoryTemplateFile::new(PathBuf::from("src/lib.rs"),
- String::from(r#"#[test]
-fn it_works() {
+ String::from(r#"#[cfg(test)]
+mod tests {
+ #[test]
+ fn it_works() {
+ }
}
"#)));
vec![lib_file]
assert_that(&paths::root().join("foo/src/lib.rs"), existing_file());
assert_that(&paths::root().join("foo/.gitignore"), is_not(existing_file()));
+ let lib = paths::root().join("foo/src/lib.rs");
+ let mut contents = String::new();
+ File::open(&lib).unwrap().read_to_string(&mut contents).unwrap();
+ assert_eq!(contents, r#"#[cfg(test)]
+mod tests {
+ #[test]
+ fn it_works() {
+ }
+}
+"#);
+
assert_that(cargo_process("build").cwd(&paths::root().join("foo")),
execs().with_status(0));
}